import { Role } from 'src/global-type';

export interface QuerySingleSystemUserParams {
  account?: string;
  userName?: string;
  role?: Role | { $in: Role[] };
  _id?: string;
  auth?: string;
}

export interface QuerySingleAuthParamsType {
  _id?: string;
  userId?: string;
}

export interface CreateSystemUserType {
  account: string;
  userName: string;
  password: string;
  role: Role;
  phoneNumber?: string;
  email?: string;
  ownerId?: string;
  ownerName?: string;
  auth: string;
}

// TODO: 扩展权限
export interface CreateAuthType {
  userId?: string;
  systemUser: string[];
  systemLog: string[];
}

export type UpdateAuthType = Partial<CreateAuthType>;

export type UpdateSystemUserType = Partial<CreateSystemUserType> & {
  lastLogin?: Date;
};

export interface UpdateSystemUserParams {
  $set?: UpdateSystemUserType;
  $inc?: {
    loginTimes?: number;
  };
}

export interface QueryMulSystemUserParams {
  role?: Role | { $in: Role[] };
}

export interface QueryMulAuthsParams {
  _id?: { $in: string[] };
}
